package com.dlry.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.dlry.db.ShareRepository;
import com.dlry.entity.DlShare;

@Service
public class ShareServiceImple implements ShareService {
	@Autowired
	private ShareRepository shareRepository;

	public void save(DlShare share) {
		shareRepository.save(share);
	}

	public void update(DlShare share) {
		shareRepository.save(share);
	}

	public DlShare findOne(Long id) {
		return shareRepository.findOne(id);
	}

	public void delete(Long id) {
		shareRepository.delete(id);
	}

	public void delete(DlShare share) {
		shareRepository.delete(share);
	}

	public Page<DlShare> findAll(Integer page, Integer rows) {
		Pageable pageable = new PageRequest(page, rows);
		return shareRepository.findAll(pageable);
	}

	public List<DlShare> findAll() {
		return shareRepository.findAll();
	}

}
